<%@page import="java.util.Date"%>
<%@page import="db.Hooldusteenus"%>
<%@page import="java.util.List"%>
<%@page import="db.Kinnistu"%>
<%@page import="java.text.SimpleDateFormat"%>
<%
    if (request.getAttribute("kinnistud") != null) {
		List<Kinnistu> kinnistud = (List<Kinnistu>) request.getAttribute("kinnistud");
%>
<tr>
	<td>Kinnistu</td>
</tr>
<tr>
	<td><select name="kinnistu" required>
		<%
		    for (Kinnistu k : kinnistud) {
				    out.println("<option value='" + k.getKinnistuId() + "' >"
					    + k.getAadress() + "</option>");
				}
		%>
	</select></td>
</tr>
<%
    }
	if (request.getAttribute("teenused") != null) {
	    List<Hooldusteenus> hooldusteenused = (List<Hooldusteenus>) request.getAttribute("teenused");
%>
<tr>
	<td>Hooldusteenus</td>
</tr>
<tr>
	<td><select name="teenus" required>
		<%
		    for (Hooldusteenus h : hooldusteenused) {
				    out.println("<option value='" + h.getHooldusteenusId() + "' >"
					    + h.getNimi() + "</option>");
				}
		%>
	</select></td>
</tr>
<tr>
	<td>Teenuse osutamise algus (orienteeruv)</td>
</tr>
<tr>
	<td><input name="algus" type="date" 
	min="<% SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
	out.print(f.format(new Date())); %>"required></td>
</tr>
<tr>
<%}%>